import React from 'react';
import InviteAgent from './InviteAgent';
import InviteClient from './InviteClient';
import { SelectAgentOptions } from '@/modules/interface';

interface InviteFormProps {
	type: 'sceneTransfer' | 'agentTransfer' | 'inviteAgent' | 'inviteClient';
	onCancel: () => void;
	onDropdown: () => void;
	onScroll: () => void;
	changeGroupSkill: (options: any) => void;
	inviteAgentError?: string;
	groupSkillError?: string;
	requestDatasource?: boolean;
	selectAgentOptions: SelectAgentOptions[];

	inviteAgent: (data: { agentName?: string; groups: { id: number; name: string }[] | null; mode: 'agent' | 'groupSkill' }) => void;
}

const InviteForm = (props: InviteFormProps) => {
	const { type, onCancel, inviteAgent, inviteAgentError = '', groupSkillError = '', changeGroupSkill, onScroll, onDropdown, selectAgentOptions, requestDatasource = false } = props;
	return (
		<>
			{type === 'inviteAgent' ? (
				<InviteAgent
					changeGroupSkill={changeGroupSkill}
					type={type}
					inviteAgentError={inviteAgentError}
					groupSkillError={groupSkillError}
					submit={inviteAgent}
					onCancel={onCancel}
					onDropdown={onDropdown}
					onScroll={onScroll}
					selectAgentOptions={selectAgentOptions}
					requestDatasource={requestDatasource}
				></InviteAgent>
			) : (
				<InviteClient onCancel={onCancel}></InviteClient>
			)}
		</>
	);
};

export default InviteForm;
